package com.timothy.android.view;

import java.util.ArrayList;
import java.util.List;

import com.timothy.answer.ChoiceResult;

public class BaseBean {
	private Integer questionType;  //questionType
	private Integer questionIndex;  //questionIndex
	private Integer TotalQuestionCount;  //TotalQuestionCount for a session
	
	private String questionText;  //questions
	private Integer totalPages;//how many pages
	private Integer numPerPage;//charts per page
	private Integer totalCount;//total count
	
	private Integer answerTextStyle;
	
	private List<PageBaseBean> pageList = new ArrayList<PageBaseBean>();

	public Integer getQuestionType() {
		return questionType;
	}

	public void setQuestionType(Integer questionType) {
		this.questionType = questionType;
	}

	public Integer getQuestionIndex() {
		return questionIndex;
	}

	public void setQuestionIndex(Integer questionIndex) {
		this.questionIndex = questionIndex;
	}

	public Integer getTotalQuestionCount() {
		return TotalQuestionCount;
	}

	public void setTotalQuestionCount(Integer totalQuestionCount) {
		TotalQuestionCount = totalQuestionCount;
	}

	public String getQuestionText() {
		return questionText;
	}

	public void setQuestionText(String questionText) {
		this.questionText = questionText;
	}

	public Integer getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(Integer totalPages) {
		this.totalPages = totalPages;
	}

	public Integer getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(Integer numPerPage) {
		this.numPerPage = numPerPage;
	}

	public List<PageBaseBean> getPageList() {
		return pageList;
	}

	public void setPageList(List<PageBaseBean> pageList) {
		this.pageList = pageList;
	}
	
	public Integer getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
	}

	public PageBaseBean getCurrentPageBaseBean(Integer page){
		for(PageBaseBean bean:pageList){
			if(bean.getPage().equals(page)){
				return bean;
			}
		}
		return null;
	}
	
	public void addPageBaseBean(PageBaseBean bean){
		pageList.add(bean);
	}

	public Integer getAnswerTextStyle() {
		return answerTextStyle;
	}

	public void setAnswerTextStyle(Integer answerTextStyle) {
		this.answerTextStyle = answerTextStyle;
	}
	
	
	//get all choice result, for those do not want display with pages
	public List<ChoiceResult> getAllChoiceResultList(){
		List<ChoiceResult> choiceResultList = new ArrayList<ChoiceResult>();
		
		for(int i=0;i<pageList.size();i++){
			PageBaseBean pageBaseBean = pageList.get(i);
			for(int j=0;j<pageBaseBean.getCrList().size();j++){
				ChoiceResult cr = pageBaseBean.getCrList().get(j);
				choiceResultList.add(cr);
			}
		}
		
		return choiceResultList;
	}
	
	
	
	
}
